import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;

import javax.swing.JPanel;

public class SimulationPanel extends JPanel{
	
	private ArrayList<VehicleRectangle> rlist = new ArrayList<VehicleRectangle>();
	
	public SimulationPanel(int width, int height){
		setPreferredSize(new Dimension(width, height));
	}
	
	public void addVehicle(Vehicle v){
		rlist.add(new VehicleRectangle((int)(v.position.x), (int)(v.position.y), (int)(v.length), (int)(v.width), v));
	}
	
	public void paintComponent(Graphics g){
		super.paintComponent(g);
	    Graphics2D g2 = (Graphics2D)g;
	    for(VehicleRectangle r : rlist){
	    	r.setLocation(r.getXPos(), r.getYPos());
	    	g2.draw(r);
	    }
	}
}
